<!DOCTYPE html>
<html lang="en">
<head>
    <title>统计</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link href="/static/layui/css/layui.css" rel="stylesheet">
</head>
<body>
<blockquote class="layui-elem-quote">
   统计信息目前尚未做持久化，未来版本会完善！
</blockquote>
<script type="text/html" id="statsToolbar">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" lay-event="flushTable">刷新</button>
    </div>
</script>
<table class="layui-hide" id="test" lay-filter="test"></table>
<script type="text/html" id="post_table_tool">
    <div class="layui-clear-space">
        <a class="layui-btn layui-btn-xs" lay-event="view">详细</a>
    </div>
</script>
<script src="/static/layui/layui.js"></script>
<script>
    layui.use(['form', 'table', 'dropdown'], function () {
        const table = layui.table;
        table.render({
            elem: '#test',
            text: "空空如也",
            skin: "line",
            url: '/metrics',
            toolbar: '#statsToolbar',
            cellMinWidth: 80,
            cols: [[
                {field: 'remotePort', fixed: 'left', width: 120, title: '公网端口', sort: true},
                {field: 'readMsgs', title: '读取消息条数'},
                {field: 'writeMsgs', sort: true, title: '写消息条数'},
                {field: 'readBytes', sort: true, title: '读取字节数'},
                {field: 'writeBytes', sort: true, title: '写字节数'},
                {field: 'channels', sort: true, title: '连接数'},
                {field: 'time', sort: true, title: '时间'},
            ]],
            error: function (res, msg) {
                console.log(res, msg)
            }
        });
    });
</script>
</body>
